home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / wb / czesc_4 / viruscheck / checkfile210.lha / CheckFile2 / CheckFile2.vzrx < prev    next >
Text File  |  1996-10-15  |  6KB  |  214 lines

  1. /*
  2. $VER: CheckFile2 v2.09 (1312/10/1996)
  3. Template: CheckFile2.vzrx FILE/A, QUIT/S
  4. */
  5.  
  6. VirusZ_prg = "DH0:Productivity/VirusUtils/VirusZ"  /* Path&Filename of VirusZ Executeable */
  7.  
  8. LHA_prg = "LHA"       /* Settings for Path where LHA DeArchiver program is */
  9. LZX_prg = "LZX"       /* Settings for Path where LZX DeArchiver program is */
  10. ZIP_prg = "UnZip"     /* Settings for Path where ZIP DeArchiver program is */
  11. RAR_prg = "UnRar"     /* Settings for Path where Rar DeArchiver program is */
  12. DMS_prg = "DMS"       /* Settings for Path where DMS DeArchiver program is */
  13.  
  14. DirTemp = "DH1:T/Temp/TempArcDir"    /* Directory to check file based archives */
  15.  
  16.  
  17. /* Settings for Disk Checking */
  18. DiskTemp = "FF0:"      /* Path To check DMS archives (Virtual or Real can be used) */
  19. DiskBlnk = "Yes"       /* Either 'Yes' or anything else for 'No' to Format */
  20. FormatName = "Tested"  /* Name of disk after it is formatted */
  21. DiskRmve = "No"        /* Either 'Yes' or anything else for 'No' to remove(UnMount) */
  22. Remove_prg = "Assign Dismount"  /* Program used to remove(UnMount) Virtual Disk (RemSD0, RemRAD or Assign DisMount)*/
  23.  
  24.  
  25. Delete_prg = "C:Delete"          /* Where the Delete command is and what it is called */
  26. Mount_prg = "C:Mount"            /* Where the Mount command is and what it is called */
  27. Protect_prg = "C:Protect"        /* Where the Protect command is and what it is called */
  28. Format_prg = "SYS:System/Format" /* Where the Format command is and what it is called */
  29.  
  30.  
  31. /* Start of the program, Do NOT alter past this line! */
  32.  
  33. Quit_Check = "UnSet"      /* Check variable for VirusZ running */
  34.  
  35. Options Results
  36. Options FailAt 60
  37.  
  38.  
  39. Parse Upper Arg File2Check Quit_Opt
  40. IF File2Check = "" Then Do               /* Checks if a filename was given */
  41.     Say "No filename given to check!"
  42.     Exit
  43.     End
  44.  
  45.  
  46. ArcType = Index(File2Check,.LHA) + Index(File2Check,.LZH) + Index(File2Check,.LZX) + Index(File2Check,.ZIP) + Index(File2Check,.RAR) + Index(File2Check,.DMS)
  47. IF ArcType = 0 Then Do
  48.     FileX = "NotArc"
  49.     Signal VirusZFileCheck
  50.     End
  51.  
  52. IF ~Show(Ports,VIRUSZ_II.REXX) Then Do
  53.     Address Command VirusZ_prg
  54.     Quit_Check = "Set"
  55.     StartTime = Time(Seconds)
  56.     Do While ~Show(Ports,VIRUSZ_II.REXX)
  57.         IF Time(Seconds) - StartTime > 25 Then Do
  58.             Say "Error loading VirusZ!  (Review CheckFile2 Prefs)"
  59.             Exit
  60.             End
  61.         End
  62.     End
  63.  
  64. IF Exists(DirTemp) Then Do
  65.     Address Command Protect_prg ">NIL: <NIL: "DirTemp" +RWED ALL"
  66.     Address Command Delete_prg ">NIL: <NIL: "DirTemp" ALL FORCE"
  67.     IF RC ~= 0 Then Do
  68.         Say "Error trying to empty temporary directory!"
  69.         Signal VirusZShutDown
  70.         End
  71.     End
  72.  
  73.  
  74.  
  75. /* DeArchiving Section */
  76.  
  77.  
  78. ArcType = Index(File2Check,.LHA) + Index(File2Check,.LZH)
  79. IF ArcType ~= 0 Then Do
  80.     Address Command LHA_prg ">NIL: <NIL: x "File2Check DirTemp"/"
  81.     IF RC ~= 0 Then Do
  82.         Say "Error extracting "File2Check" archive!"
  83.         Signal DeleteDirTemp
  84.         End
  85.     Signal VirusZArcCheck
  86.     End
  87. ArcType = Index(File2Check,.LZX)
  88. IF ArcType ~= 0 Then Do
  89.     Address Command LZX_prg ">NIL: <NIL: x "File2Check DirTemp"/"
  90.     IF RC ~= 0 Then Do
  91.         Say "Error extracting "File2Check" archive!"
  92.         Signal DeleteDirTemp
  93.         End
  94.     Signal VirusZArcCheck
  95.     End
  96. ArcType = Index(File2Check,.ZIP)
  97. IF ArcType ~= 0 Then Do
  98.     Address Command "MakeDir "DirTemp
  99.     IF RC ~= 0 Then Do
  100.         Say "Error making temporary directory!"
  101.         Signal VirusZShutDown
  102.         End
  103.     Address Command ZIP_prg ">NIL: "File2Check "-d "DirTemp"/"
  104.     IF RC ~= 0 Then Do
  105.         Say "Error extracting "File2Check" archive!"
  106.         Signal DeleteDirTemp
  107.         End
  108.     Signal VirusZArcCheck
  109.     End
  110. ArcType = Index(File2Check,.RAR)
  111. IF ArcType ~= 0 Then Do
  112.     Address Command "MakeDir "DirTemp
  113.     IF RC ~= 0 Then Do
  114.         Say "Error making temporary directory!"
  115.         Signal VirusZShutDown
  116.         End
  117.     Address Command RAR_prg ">NIL: x "File2Check DirTemp"/"
  118.     IF RC ~= 0 Then Do
  119.         Say "Error extracting "File2Check" archive!"
  120.         Signal DeleteDirTemp
  121.         End
  122.     Signal VirusZArcCheck
  123.     End
  124. ArcType = Index(File2Check,.DMS)
  125. IF ArcType  ~= 0 Then Do
  126.     FileX = "DMS"
  127.     Address Command "Assign >NIL: "DiskTemp" exists"
  128.         IF RC = 5 Then Address Command "Mount >NIL: "DiskTemp
  129.     Address Command DMS_prg " >NIL: <NIL: Write "File2Check " To "DiskTemp" NOVERIFY"
  130.     IF RC ~= 0 Then Do
  131.         Say "Error extracting "File2Check" archive!"
  132.         Signal DeleteDisk
  133.         End
  134.     Signal VirusZDMSCheck
  135.     End
  136.  
  137.  
  138.  
  139. /* Virus Checking Section */
  140.  
  141.  
  142. VirusZArcCheck:
  143. IF Exists(DirTemp) Then Do
  144.     Address VIRUSZ_II.REXX CHECKDIR DirTemp DECREXEC DECRDATA
  145.     IF RC = 0 Then Say "Archive "File2Check" is clean."
  146.     IF RC = 5 Then Say "Archive "File2Check" contains virus(es)!"
  147.     IF RC = 10 Then Say "Error checking "File2Check" archive!"
  148.     Signal DeleteDirTemp
  149.     End
  150.  
  151. VirusZFileCheck:
  152. IF FileX = "NotArc" Then Do
  153.     Address Command "MakeDir "DirTemp
  154.     Address Command "Copy "File2Check" to "DirTemp"/ QUIET NOPRO NOREQ"
  155.     Address VIRUSZ_II.REXX CHECKDIR DirTemp DECREXEC DECRDATA
  156.     IF RC = 0 Then Say "File "File2Check" is clean."
  157.     IF RC = 5 Then Say "File"File2Check" contains virus(es)!"
  158.     IF RC = 10 Then Say "Error checking "File2Check" File!"
  159.     Signal DeleteDirTemp
  160.     End
  161.  
  162. VirusZDMSCheck:
  163. IF FileX = "DMS" Then Do
  164.     Address VIRUSZ_II.REXX CHECKDIR DiskTemp DECREXEC DECRDATA
  165.     IF RC = 0 Then Say "Archive "File2Check" is clean."
  166.     IF RC = 5 Then Say "Archive "File2Check" contains virus(es)!"
  167.     IF RC = 10 Then Say "Error checking "File2Check" archive!"
  168.     Signal DeleteDisk
  169.     End
  170.  
  171. DeleteDisk:
  172. IF FileX = "DMS" Then Do
  173.     Upper DiskBlnk
  174.     Upper DiskRmve
  175.     IF DiskBlnk = "YES" Then Do
  176.         Address Command Format_prg " >NIL: <NIL: DEVICE="DiskTemp" NAME="FormatName" FFS INTL NOICONS QUICK"
  177.         IF RC ~= 0 Then Do
  178.             Say "Error blanking checked disk!"
  179.             Signal VirusZShutDown
  180.             End
  181.         End
  182.     IF DiskRmve = "YES" Then Do
  183.         Address Command Prog_Rmv DiskPath
  184.         IF RC ~= 0 Then Do
  185.             Say "Error Dismounting checked disk!"
  186.             Signal VirusZShutDown
  187.             End
  188.         End
  189.     Signal VirusZShutDown
  190.     End
  191.  
  192.  
  193. DeleteDirTemp:
  194. IF Exists(DirTemp) Then Do
  195.     Address Command Protect_prg DirTemp"/#? RWED ADD ALL QUIET"
  196.     Address Command Delete_prg ">NIL: <NIL:" DirTemp ALL
  197.     IF RC ~= 0 Then Do
  198.         Say "Error deleting temporary directory!"
  199.         Signal VirusZShutDown
  200.         End
  201.     Signal VirusZShutDown
  202.     End
  203.  
  204.  
  205. VirusZShutDown:
  206. IF Quit_Check = "Set" Then Do
  207.     IF Quit_Opt = "QUIT" Then Do
  208.         Address VIRUSZ_II.REXX QUIT
  209.         End
  210.     Say " "
  211.     End
  212.  
  213.  
  214.